<script setup>
import {onMounted, ref} from "vue";
import {SelectResume} from "@/utils/api/graduate.js";
import {ElMessage} from "element-plus";
import {useUserLoginStore} from "@/stores/AccountLogin.js";

const sno = useUserLoginStore().getAccount;
const enterpriseName = ref('');
const data = ref([{
  eno: '',
  enterpriseName: '',
  jobId:'',
  resume: '',
  opTime: '',
}]);

const select = () => {
  data.value = [];
  SelectResume(sno, enterpriseName.value)
      .then(result => {
        if (result.code === 1) {
          data.value = result.data;
        } else {
          ElMessage({
            message: "服务器错误",
            type: 'warning',
          })
        }
      }).catch(error => console.error(error.toString()));
}
onMounted(() => {
  select();
})
</script>

<template>
  <div class="main">
    <el-form inline>
      <el-form-item label="企业名称">
        <el-input type="text" v-model="enterpriseName" placeholder="企业名称"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="select()">筛 选</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="data" border stripe max-height="550px">
      <el-table-column prop="eno" label="企业编号"/>
      <el-table-column prop="enterpriseName" label="企业名称"/>
      <el-table-column prop="jobId" label="职位id"/>
      <el-table-column prop="resume" label="简历"/>
      <el-table-column prop="opTime" label="投递日期"/>
    </el-table>
  </div>
</template>

<style scoped>
.main {
  min-width: 1100px;
  max-height: 500px;
}
</style>